package com.k.demo.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.k.demo.entity.Evaluation;
import com.k.demo.mapper.EvaluationMapper;
import com.k.demo.service.EvaluationService;
@Service
public class EvaluationServiceImpl implements EvaluationService {
	@Autowired
	private EvaluationMapper evaluationMapper;

	@Override
	public int addEvaluation(Evaluation evaluation) {
		// TODO Auto-generated method stub
		int count=evaluationMapper.insert(evaluation);
		return count;
	}

	@Override
	public int deleteEvaluation(int evaluation_id) {
		// TODO Auto-generated method stub
		int count=evaluationMapper.delete(evaluation_id);
		return count;
	}

	@Override
	public List<Evaluation> getEvaluationByFood(int food_id) {
		// TODO Auto-generated method stub
		
		return evaluationMapper.selectAll(food_id);
	}

	@Override
	public int count(int food_id) {
		// TODO Auto-generated method stub
		return evaluationMapper.count(food_id);
	}

	@Override
	public List<Evaluation> getWithImg(int food_id) {
		// TODO Auto-generated method stub
		return evaluationMapper.selectWithImg(food_id);
	}

	@Override
	public List<Evaluation> getWithQuality(int food_id) {
		// TODO Auto-generated method stub
		return evaluationMapper.selectQuality(food_id);
	}

	@Override
	public Double getAvgEvaluationLv(int food_id) {
		// TODO Auto-generated method stub
		return evaluationMapper.selectavglv(food_id);
	}
	
	
}
